package com.ruoyi.hospital.service.member.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.member.MemberCommentMapper;
import com.ruoyi.hospital.domain.member.MemberComment;
import com.ruoyi.hospital.service.member.IMemberCommentService;

/**
 * 用户评论Service业务层处理
 * 
 * @author wendao
 * @date 2024-09-29
 */
@Service
public class MemberCommentServiceImpl implements IMemberCommentService 
{
    @Autowired
    private MemberCommentMapper memberCommentMapper;

    /**
     * 查询用户评论
     * 
     * @param id 用户评论主键
     * @return 用户评论
     */
    @Override
    public MemberComment selectMemberCommentById(Integer id)
    {
        return memberCommentMapper.selectMemberCommentById(id);
    }

    /**
     * 查询用户评论列表
     * 
     * @param memberComment 用户评论
     * @return 用户评论
     */
    @Override
    public List<MemberComment> selectMemberCommentList(MemberComment memberComment)
    {
        return memberCommentMapper.selectMemberCommentList(memberComment);
    }

    @Override
    public MemberComment selectMemberCommentLimitOne(Integer commentId) {
        return memberCommentMapper.selectMemberCommentLimitOne(commentId);
    }

    /**
     * 新增用户评论
     * 
     * @param memberComment 用户评论
     * @return 结果
     */
    @Override
    public int insertMemberComment(MemberComment memberComment)
    {
        memberComment.setCreateTime(DateUtils.getNowTimeSecond());
        return memberCommentMapper.insertMemberComment(memberComment);
    }

    /**
     * 修改用户评论
     * 
     * @param memberComment 用户评论
     * @return 结果
     */
    @Override
    public int updateMemberComment(MemberComment memberComment)
    {
        memberComment.setUpdateTime(DateUtils.getNowTimeSecond());
        return memberCommentMapper.updateMemberComment(memberComment);
    }

    /**
     * 批量删除用户评论
     * 
     * @param ids 需要删除的用户评论主键
     * @return 结果
     */
    @Override
    public int deleteMemberCommentByIds(Integer[] ids)
    {
        return memberCommentMapper.deleteMemberCommentByIds(ids);
    }

    /**
     * 删除用户评论信息
     * 
     * @param id 用户评论主键
     * @return 结果
     */
    @Override
    public int deleteMemberCommentById(Integer id)
    {
        return memberCommentMapper.deleteMemberCommentById(id);
    }

    @Override
    public int getNumsByIdAndType(Integer type, Integer cid) {
        return memberCommentMapper.getNumsByIdAndType(type,cid);
    }
}
